package com.asset.dispoal.business.bsCase;

import com.asset.dispoal.business.bsCase.api.BsCaseService;
import com.asset.dispoal.business.bsCase.dto.BsCaseRequest;
import com.asset.dispoal.business.bsCase.dto.BsCaseResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import tech.mhuang.pacebox.springboot.core.controller.BaseController;
import tech.mhuang.pacebox.springboot.core.permission.annotation.Permission;
import tech.mhuang.pacebox.springboot.protocol.Result;
import tech.mhuang.pacebox.springboot.protocol.data.PageVO;

/**
 * @author qr
 * @date 2022/4/12$
 */
@RestController
@Api(value = "案件管理", tags = "案件管理")
@RequestMapping("business/bsCase")
public class BsCaseController extends BaseController {
    @Autowired
    BsCaseService bsCaseService;

    @Permission(code = "caseManageMatching:query", param = "create_user")
    @GetMapping("queryBorrowerCaseByPage")
    @ApiOperation(value = "借款人合同根据案件分组分页查询", notes = "借款人合同根据案件分组分页查询")
    public Result<PageVO<BsCaseResponse>> queryBorrowerCaseByPage(BsCaseRequest bsCaseRequest) {
        return bsCaseService.queryBorrowerCaseByPage(bsCaseRequest);
    }

    @GetMapping("/getCaseById")
    @ApiModelProperty(value = "当个案件信息", notes = "单个案件信息")
    public Result<BsCaseResponse> getCaseById(String id) {
        return bsCaseService.getCaseById(id);
    }

    @GetMapping(value = "caseClose")
    @ApiOperation(value = "结案", notes = "结案")
    public Result caseClose(String agreementId) {
        return bsCaseService.caseClose(agreementId);
    }

    @GetMapping(value = "abolishCase")
    @ApiOperation(value = "废案", notes = "废案")
    public Result abolishCase(String id, String wasteReasonId) {
        return bsCaseService.abolishCase(id, wasteReasonId);
    }

    @GetMapping(value = "/censusRefresh")
    @ApiOperation(value = "户籍刷新接口", notes = "户籍刷新接口")
    public Result censusRefresh() {
        return bsCaseService.censusRefresh();
    }

    @GetMapping(value = "/statistics")
    @ApiOperation(value = "统计", notes = "统计")
    public Result statistics(String code) {
        return bsCaseService.statistics(code);
    }
}
